package com.jmodata.zxu.service.impl.manager;

import com.jmodata.zxu.dao.MyBatisCommonDAO;
import com.jmodata.zxu.model.DataGrid;
import com.jmodata.zxu.pojo.manager.LoginLog;
import com.jmodata.zxu.service.manager.LoginLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service("loginLogService")
@Transactional(rollbackFor=Exception.class)
public class LoginLogServiceImpl implements LoginLogService {

	@Autowired
	private MyBatisCommonDAO myBatisCommonDAO;

	@Override
	public int insertLoginLog(LoginLog loginLog) throws Exception {
		return myBatisCommonDAO.executeInsert("loginLog.insertLoginLog", loginLog);
	}

	@Override
	public DataGrid loginLogList(Map<Object, Object> map) throws Exception {
		DataGrid dg=new DataGrid();
		List<LoginLog> list=myBatisCommonDAO.executeForObjectList("loginLog.loginLogList", map);
		dg.setRows(list);
		dg.setTotal(myBatisCommonDAO.executeForObjectListCount("loginLog.loginLogListCount", map));
		return dg;
	}

}
